<?php

class Application_Model_AclLibrary extends Zend_Acl
{

	public function __construct() {

		/**
		 * Userroles
		 */
		$this->addRole(new Zend_Acl_Role('admin'));
		$this->addRole(new Zend_Acl_Role('superuser'), 'admin');
		$this->addROle(new Zend_Acl_Role('pricingmanager'), 'superuser');
		$this->addRole(new Zend_Acl_Role('insidesales'), 'superuser');
		$this->addRole(new Zend_Acl_Role('kam'), 'insidesales');
		$this->addRole(new Zend_Acl_Role('brandmanager'), 'kam');
		$this->addRole(new Zend_Acl_Role('accountant'), 'insidesales');
		
		/**************************************************/

		/**
		 * Controller Resource
		 */
		$this->add(new Zend_Acl_Resource('index'));
		$this->add(new Zend_Acl_Resource('authenticate'));
		$this->add(new Zend_Acl_Resource('error'));
		$this->add(new Zend_Acl_Resource('settings'));
		$this->add(new Zend_Acl_Resource('user'));
		$this->add(new Zend_Acl_Resource('inventoryitem'));
		$this->add(new Zend_Acl_Resource('salesrep'));
		$this->add(new Zend_Acl_Resource('maintenance'));
		$this->add(new Zend_Acl_Resource('managementunit'));
		$this->add(new Zend_Acl_Resource('customer'));
		$this->add(new Zend_Acl_Resource('campaign'));
		$this->add(new Zend_Acl_Resource('soa'));
		$this->add(new Zend_Acl_Resource('itemlisting'));
		$this->add(new Zend_Acl_Resource('rma'));
		$this->add(new Zend_Acl_Resource('ajax'));
		


		/**************************************************/

		/**
		 * ACCESS RULES
		 */

		$this->allow('admin');
		$this->deny('superuser', 'settings', 'showmpcmapping');
		$this->deny('superuser', 'settings', 'lockfcst');
		$this->deny('superuser', 'user', 'add');
		$this->deny('superuser', 'user', 'edit');
		$this->deny('superuser', 'itemlisting');
		$this->deny('superuser', 'inventoryitem');
		$this->deny('superuser', 'salesrep');
		$this->deny('insidesales', 'user');
		$this->deny('insidesales', 'settings');
		$this->deny('insidesales', 'inventoryitem');
		$this->deny('insidesales', 'salesrep');
		$this->deny('insidesales', 'itemlisting');
		
		$this->deny('pricingmanager', 'user');
		$this->deny('pricingmanager', 'settings');
		$this->deny('pricingmanager', 'inventoryitem');
		$this->deny('pricingmanager', 'salesrep');
		$this->deny('pricingmanager', 'customer');
		$this->deny('pricingmanager', 'managementunit');
		
		$this->allow('pricingmanager', 'itemlisting');
		$this->allow('pricingmanager', 'user', 'accountinfo');
	}

}

